﻿package com.wandian.view.components.ui
{
	import com.wandian.ApplicationFacade;
	import com.wandian.controller.CLZNoticeName;
	import com.wandian.data.GameData;
	import com.wandian.model.AccountProxy;
	import com.wandian.model.vo.FaceVo;
	import com.wandian.model.vo.PropVo;
	import com.wandian.model.vo.RoomVo;
	import com.wandian.util.CLZButton;
	import com.wandian.util.CLZLlistScrollPanel;
	import com.wandian.util.CLZLoadIcon;
	import com.wandian.util.CLZTabBar;
	import com.wandian.util.CLZZoom;
	import com.wandian.util.GlowFilterManage;
	import com.wandian.util.ToolTip;
	
	import flash.display.MovieClip;
	import flash.display.Sprite;
	import flash.events.Event;
	import flash.events.EventDispatcher;
	import flash.events.MouseEvent;
	import flash.events.TextEvent;
	/**   
	* @author long
	* @QQ 108232706
	* @version 1.0   
	*/   
	public class PersonInfoMc extends EventDispatcher
	{
		private var _mcInfo:MovieClip;
		private const UP:int=1;
		private const OVER:int=2;
		private const DOWN:int=3;
		private var _arrInfo:Array;
		private var _facade:ApplicationFacade;
		private var _personVo:PropVo;
		private var _global:GameData;

		public function PersonInfoMc(mcPic:MovieClip, prop:PropVo)
		{
			this._facade=ApplicationFacade.getInstance();
			this._global=GameData.getInstance();
			this._mcInfo=mcPic;
			this._personVo=prop;
			this._mcInfo.gotoAndStop(this.UP);
			this._mcInfo.addEventListener(MouseEvent.ROLL_OUT, this.outHandler);
			this._mcInfo.addEventListener(MouseEvent.ROLL_OVER, this.overHandler);
			CLZLoadIcon.addIcon(this._mcInfo, GameData.flashUrl + GameData.config["imageUrl"] + "person/min/" + prop.pframe + ".png", 0, 0, 0, 0, "LoadingData", false);
			if (prop.price == 0)
			{
				this._mcInfo["price_txt"].text=GameData.tip["FREE"];
			}
			else
			{
				this._mcInfo["price_txt"].text=prop.price + GameData.tip["GOLD"];
			}
			if (int(this._global.userInfo.userVo.icon) == 0)
			{
				CLZButton.setButton(this._mcInfo.btn, GameData.tip["SELECTED_NAME"]);
			}
			else
			{
				CLZButton.setButton(this._mcInfo.btn, GameData.tip["UPDATE"]);
			}
			this._mcInfo.btn.addEventListener(MouseEvent.CLICK, this.changePersonHandler);
			return;
		} 

		private function changePersonHandler(event:MouseEvent):void
		{
			this._facade.sendNotification(CLZNoticeName.UPDATE_PERSON_ID_TIP, this._personVo);
			return;
		} 

		private function outHandler(event:MouseEvent=null):void
		{
			this._mcInfo.gotoAndStop(this.UP);
			return;
		} 

		private function overHandler(event:MouseEvent):void
		{
			this._mcInfo.gotoAndStop(this.OVER);
			return;
		} 

	}
}
